


import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

import 'MyDialog.dart';

class showCusDialog extends StatelessWidget {
  const showCusDialog({super.key});


  void _myDialog(BuildContext context) async {
    await showDialog(
        barrierDismissible: true, //表示点击灰色背景的时候是否消失弹出框
        context: context,
        builder: (context) {
          return MyDialog(
              title: '标题',
              onClosed: () {
                print("关闭");
                Navigator.of(context).pop();
              },
              content: "我是一个内容");
        });
  }


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter SimpleDialog Example'),
      ),
      body:Column(
         children: [
           Center(
             child: ElevatedButton(
               onPressed: () {
                 _myDialog(context);
               },
               child: Text('Show Alert'),
             ),
           ),

           Center(
             child: ElevatedButton(
               onPressed: () {
                 Fluttertoast.showToast(
                     msg: "提示信息",
                     toastLength: Toast.LENGTH_SHORT,
                     gravity: ToastGravity.BOTTOM,
                     timeInSecForIosWeb: 1,
                     backgroundColor: Colors.black,
                     textColor: Colors.white,
                     fontSize: 16.0
                 );
               },
               child: Text('第三方ToastUtils 1'),
             ),
           ),



         ],
      ),
    );
  }
}
